﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Provenance.Domain.Slaughter;
using Provenance.ErrorCount;
using Provenance.Read.Api.Application.Command.Slaughter;

namespace Provenance.Read.Api.Controllers
{
    [Route("api/slaughter/[controller]/[action]")]
    [ApiController]
    public class SlaughterController : ControllerBase
    {
        private readonly IMediator _mediator;
        public SlaughterController(IMediator mediator)
        {
            _mediator = mediator;
        }

        [HttpGet]
        public async Task<ApiResult<SlaughterInfo>> BackSlaughterInfo([FromQuery] int pid)
        {
            return await _mediator.Send(new BackSlaughterInfoCommand()
            {
                ProductInfoId = pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<SlaughterEnterprise>> BackSlaughterEnterprise([FromQuery] int pid)
        {
            return await _mediator.Send(new BackSlaugtherEnterpriseCommand()
            {
                ProductInfoId = pid
            });
        }





    }
}
